package com.damBowling.mybolos;

import com.damBowling.mybolos.R;
import com.damBowling.mybolos.R.layout;
import com.damBowling.mybolos.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class CalendarioReservasActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.calendar);
		Intent intent = new Intent(getApplicationContext(),CalendarView.class);
		intent.putExtra("date","2012-10-31");
		startActivityForResult(intent, 1);	
    }

    
    @Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		super.onActivityResult(requestCode, resultCode, data);
		if (requestCode == 1) {
            if (resultCode == RESULT_OK) {
            	String fechaSeleccionada = data.getStringExtra("date");
            	if (fechaSeleccionada!=null){
            		Intent i =new Intent(getApplicationContext(),ReservasActiviti.class);
            		i.putExtra("dia", fechaSeleccionada);
            		startActivity(i);
            		finish();
            	}
            }
            if(resultCode == RESULT_CANCELED){
            	finish();
            }
		}
	}
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_calendario_reservas, menu);
        return true;
    }
}
